<template>
  <div>
    <br />
    <b-button type="is-info" expanded @click="isActive = true">回复</b-button>
    <b-modal v-model="isActive">
      <div class="card">
        <div class="card-content">
          <b-field label="Title">
            <b-input v-model="title"></b-input>
          </b-field>

          <b-field label="Message">
            <b-input maxlength="200" type="textarea" v-model="replys"></b-input>
          </b-field>
          <b-button is-type="info" @click="submit">发布回复</b-button>
        </div>
      </div>
    </b-modal>
  </div>
</template>

<script>
export default {
  data() {
    return {
      replys: "",
      title: "",
      images: [],
      isActive: false,
    };
  },
  methods: {
    //添加评论
    async submit() {
      let res = await this.$http.post(
        "/go/reply/create",
        {
          gid: await this.$parent.getGid(),
          text: this.replys,
          title: this.title,
          images: this.images,
        },
        {
          headers: {
            pass: "",
            Authorization: "Bearer " + (localStorage.getItem("token")),
          },
        }
      );
      if(res.data.status == 20000){
        this.$vs.notification({
          title: "回复成功",
        });
        this.isActive = false
        this.$router.go(0);
      }
    },
  },
};
</script>

<style>
</style>